package org.xt.module.api;

import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.By;
import org.nutz.mvc.annotation.Filters;
import org.nutz.mvc.annotation.Ok;
import org.xt.constants.Res;
import org.xt.service.SFISOpService;
@IocBean
@At("/api/http")
public class HttpApiModule {
	@Inject
	private SFISOpService httpService;
	
	@At("/getLiaohao")
	@Ok("json")
	public Res getLiaohao(String sn){
		try {
			String liaohao = httpService.getLiaohao(sn);
			if(liaohao == null || "".equals(liaohao)){
				return Res.NEW().code(Res.ERROR).msg("获取料号失败");
			}else{
				return Res.NEW().code(Res.SUCCESS).msg("获取料号成功").data(liaohao);
			}
			
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return Res.NEW().code(Res.ERROR).msg("获取料号失败");
		} 
	}
}
